POV-Ray : Newsgroups : povray.general : Unhandled Exception vs. Parse error : Re: Unhandled Exception vs. Parse error Server Time
31 Jul 2024 00:29:36 EDT (-0400)
  Re: Unhandled Exception vs. Parse error  
From: Tim Attwood
Date: 5 Mar 2008 15:35:31
Message: <47cf0413$1@news.povray.org>
>I know that trying to call a variable before you declare it is not 
>generally
> considered very bright, but I'm attempting to understand what's going on 
> in the
> code below:
>
> ----------------------------------------
> (test.pov)
> #declare RdmA = seed(574647);
> #include "rand2.inc"
> #declare X = RRand(-5,5,RdmA);
> #if (Y = 0) #end
> ----------------------------------------
>
> ----------------------------------------
> (rand2.inc)
> #macro RRand(Min, Max, RS) (rand(RS)*(Max-Min) + Min) #end
> ----------------------------------------
>
> "rand2.inc" consists of a macro copied from the original "rand.inc" file. 
> If I
> run "test.pov" above, POV-Ray throws an unhandled exception and I'm forced 
> to
> close the program.
>
> If, however, I change "test.pov" to be:
>
> ----------------------------------------
> (test2.pov)
> #declare RdmA = seed(574647);
> #macro RRand(Min, Max, RS) (rand(RS)*(Max-Min) + Min) #end
> #declare X = RRand(-5,5,RdmA);
> #if (Y = 0) #end
> ----------------------------------------
>
> ......that is, I replace the '#include' call with the macro from 
> "rand2.inc",
> then POV produces a simple parse error, as expected.
>
> So, what's the difference between using this macro in an include file and
> placing it directly in my .pov code?
>
> OS: WinXP
> POV: 3.6.1c
>
As far as the SDL is concerned this "should" be the same result,
but the first one involves file access, so it's probably a bug in POV,
or possibly in the OS. There may be a "slew time" involved with
including a file, moving the location of the include to the beginning
of the calling file may help (other commands would be processed
before using the macro, giving the files a little time to close). The
same sort of crash can happen if you include the same files from
an included file as in the calling file. For example if you have some
file "scene.pov" and it includes "rand.inc" and "mymacro.inc",
then if you include "rand.inc" inside "mymacro.inc" it could
cause a problem.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.